﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Dotway.WPF.Controls">
    <Style TargetType="{x:Type local:TransformInteraction}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TransformInteraction}">
                    <Grid RenderTransformOrigin="0.5,0.5">
                        <Grid.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Scale}" ScaleY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Scale}" />
                                <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}"/>
                                <TranslateTransform X="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=X}" Y="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Y}"/>
                            </TransformGroup>
                        </Grid.RenderTransform>

                        <ContentPresenter Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Grid.RowSpan="3"/>

                        <Grid x:Name="PART_ControlContainer" Visibility="Hidden">

                            <Grid x:Name="PART_TranslateControls" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="-5,-5,-5,-5">
                                <Rectangle Fill="Transparent" Cursor="SizeAll" />
                            </Grid>
                            <Grid x:Name="PART_ClickControls" Width="20" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="-10,-10,0,0">
                                <Rectangle Fill="Red" Stroke="Black" Cursor="Arrow" RadiusX="3" RadiusY="3"/>
                            </Grid>
                            <Grid x:Name="PART_RotateControls"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <Rectangle Fill="DimGray" Stroke="Black" RadiusX="3" RadiusY="3" Cursor="Hand" Width="20" Height="20" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-10,-10,0"/>
                                <Rectangle Fill="DimGray" Stroke="Black" RadiusX="3" RadiusY="3" Cursor="Hand" Width="20" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,-10,-10"/>
                                <Rectangle Fill="DimGray" Stroke="Black" RadiusX="3" RadiusY="3" Cursor="Hand" Width="20" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="-10,0,0,-10"/>
                            </Grid>
                            <Grid x:Name="PART_ScaleControls"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <Rectangle Fill="LightGray" Stroke="DimGray" RadiusX="3" RadiusY="3" Cursor="SizeNESW" Width="20" Height="20" VerticalAlignment="Top" HorizontalAlignment="Right"/>
                                <Rectangle Fill="LightGray" Stroke="DimGray" RadiusX="3" RadiusY="3" Cursor="SizeNWSE" Width="20" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
                                <Rectangle Fill="LightGray" Stroke="DimGray" RadiusX="3" RadiusY="3" Cursor="SizeNESW" Width="20" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
                            </Grid>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
